/**
 * Created by Administrator on 2017/1/11 0011.
 */

import {Http} from "@angular/http";
import {Injectable} from "@angular/core";
import {BaseService} from "./base.sercvice";

@Injectable()
export class SearchService extends BaseService{
  constructor(public http:Http){
    super(http);
  }

  public getMovieHome(){
    let url = 'movie/search/movie/home/';
    return super.post(url, {});
  }

  public searchKeyword(keyword, page, type) {
    let url = 'bt/search/';
    return super.post(url, {keyword: keyword, page: page, type: type});
  }

  public searchDetails(id) {
    let url = 'bt/search/detail/';
    return super.post(url, {tid: id});
  }

  public searchMovie(data) {
    let url = '';
    if (data['type'] == 'offline') {
      url = 'movie/search/movie/offline/keyword/';
    } else {
      url = 'movie/search/movie/online/keyword/';
    }
    return super.post(url, data);
  }

  public getMovieList(type, page) {
    let url = 'movie/search/movie/list/';
    return super.post(url, {movie_type: type, page: page});
  }

  public getMovieDetail(href) {
    let url = 'movie/search/movie/detail/';
    return super.post(url, {href: href});
  }

  public getSystemMessage() {
    let url = 'message/all/';
    return super.getWithoutData(url);
  }

  public getVersion() {
    let url = 'message/version/';
    return super.post(url, {});
  }

  public searchHSource(data) {
    let url = 'h/source/';
    return super.post(url, data);
  }

  public searchHType(data) {
    let url = 'h/type/';
    return super.post(url, data);
  }

  public searchHList(data) {
    let url = 'h/list/';
    return super.post(url, data);
  }

  public searchHDetails(data) {
    let url = 'h/details/';
    return super.post(url, data);
  }

}
